package com.qiyu.tech.mysql.config;

import org.mybatis.spring.annotation.MapperScannerRegistrar;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @Author linhao
 * @Date created in 12:22 下午 2021/1/28
 */
//@Configuration
//@Component
public class MapperScannerRegistrarPostProcess implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if("mapperScannerRegistrar".equals(beanName)){
            MapperScannerRegistrar mapperScannerRegistrar = (MapperScannerRegistrar) bean;
            bean = new MapperScannerRegistrarConfig();
            System.out.println("====");
        }
        System.out.println("beanName is {}" + beanName);
        return bean;
    }
}
